%%% ====================================================================
%%% header file for erslom_parse
%%% 
%%% Copyright (C) 2006 Willem de Jong
%%%
%%% This program is free software; you can redistribute it and/or modify
%%% it under the terms of the GNU General Public License as published by 
%%% the Free Software Foundation; either version 2 of the License, or 
%%% (at your option) any later version.
%%%
%%% This program is distributed in the hope that it will be useful, but
%%% WITHOUT ANY WARRANTY; without even the implied warranty of
%%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
%%% General Public License for more details.
%%%
%%% You should have received a copy of the GNU General Public License 
%%% along with this program; if not, write to the Free Software 
%%% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
%%% USA
%%%
%%% Author contact: w.a.de.jong@gmail.com
%%% ====================================================================

%%% Version: 0.0.3

%% header file for erslom_parse. Contains the record defintions.

%% the records that form the model - see erlsom_parse.erl for a 
%% description.

-record(model, {tps, nss, 
                tns}).  %% target namespace (the URI, a string)
-record(type, {nm, tp = sequence, els, atts = [], anyAttr, nillable, nr, 
               mn = 1, mx = 1}). %% mn & mx are only used by erlsom_compile
-record(el, {alts, mn = 1, mx = 1, nr}).
-record(alt, {tag, tp, nxt = [], mn = 1, mx = 1, rl = true, anyInfo}).
-record(att, {nm, nr, opt, tp}).
%% -record(ns, {uri, pf}).
-record(elInfo, {anyAttr}).
-record(anyAttr, {prCont, ns}). %% for anyAttributes
-record(anyInfo, {prCont, ns}). %% for any elements

-record(state, {currentState, resultSoFar, model, namespaces, allNamespaces}).

-record(cs, {re,     %% remaining elements
             sf,     %% nr of elements of the current type received so far
             er,     %% element record: the result (so far) for this type
             rl}).   %% 'real element': do we expect an end-tag?

-record(all, {re,     %% remaining elements
              nr,     %% the sequence number of the current element
              er}).   %% element record: the result (so far) for this type

%% altState is used for parsing alternatives within
%% a choice that can occur more than once
-record(altState, {name,          %% the tag we are processing
                   type,          %% the type of this element
                   real,          %% is this a 'real' element or a group ref
                   receivedSoFar, %% number of elements received
                   acc,           %% values of elements already processed
                   min,           %% minOccurs
                   max}).         %% maxOccurs

-record(anyState, {anyInfo}).
